Skip to content

[GSoC] CMRT 03: Preferences: Add Fingerprint Analysis preferences page and clear actions - #16604

Draft
Swarnadip-Kar wants to merge 50 commits into
mixxxdj:mainfrom
Swarnadip-Kar:pr/cmrt-phase1-prefs
Draft

[GSoC] CMRT 03: Preferences: Add Fingerprint Analysis preferences page and clear actions#16604
Swarnadip-Kar wants to merge 50 commits into
mixxxdj:mainfrom
Swarnadip-Kar:pr/cmrt-phase1-prefs

Conversation

@Swarnadip-Kar

@Swarnadip-Kar Swarnadip-Kar commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

https://github.com/mixxxdj/mixxx/pull/16604/changes/b7c31ad0cca4a98a3b32a6128487fd60fe091929..c9aef2530d41eafea55621c20baca15205f1c268

Adds the "Fingerprint Analysis" preferences page, wires the
"Clear -> Fingerprint" action in WTrackMenu, and extends
slotClearAllMetadata to also wipe fingerprint data.

DlgPrefFingerprint (new files)

dlgpreffingerprint.ui
QGridLayout with:
checkBoxFingerprintEnabled — master on/off toggle. Disabled
by default; tooltip explains the performance cost.
groupBoxAcoustId — contains:
lineEditAcoustIdApiKey — free-form key field with a
"Get your key ↗" hyperlink (opens acoustid.org/api-key).
checkBoxAcoustIdAutoSubmit — only enabled when the key
field is non-empty.
btnClearAllFingerprints — destructive action with its own
confirmation dialog (see below).

dlgpreffingerprint.h
DlgPrefFingerprint : DlgPreferencePage
slotApply() / slotUpdate() / slotResetToDefaults()
slotFingerprintEnabledToggled(bool) — enables/disables the
AcoustID group box to match the master checkbox.
slotClearAllFingerprints() — confirmation dialog, then
calls TrackFingerprintDao::clearAllFingerprintData().
setAcoustIdGroupEnabled() — additionally gates
checkBoxAcoustIdAutoSubmit on whether the key field has text.
Takes TrackCollectionManager* to access the DAO for the clear
action (forward-declared in header).

dlgpreffingerprint.cpp
slotApply()
- Trims whitespace from the API key before persisting — users
often paste a trailing space from the browser.
slotClearAllFingerprints()
- Warning QMessageBox with a "Clear All" (DestructiveRole) +
Cancel pair — same pattern as DlgPrefLibrary::slotRemoveDir().
- Calls dao.clearAllFingerprintData() and reports the count.
lineEditAcoustIdApiKey::textChanged — disables and unchecks
checkBoxAcoustIdAutoSubmit when the key is cleared, so the
config cannot be left in an inconsistent state.

Registration (dlgpreferences.cpp)
DlgPrefFingerprint added after Key Detection, labelled
"Fingerprint Analysis". Uses bpmdetect icon as a placeholder
(TODO: replace with dedicated fingerprint icon).

CMakeLists.txt
dlgpreffingerprint.cpp and dlgpreffingerprint.ui added.

AcoustID prefs config keys (library_prefs.h / library_prefs.cpp)
kAcoustIdUserApiKeyConfigKey — [Library] AcoustIdUserApiKey
kAcoustIdAutoSubmitConfigKey — [Library] AcoustIdAutoSubmit
(These three keys are declared here so the Worker PR can read them
without depending on the Prefs page itself.)

WTrackMenu clear actions (wtrackmenu.h / wtrackmenu.cpp)

slotClearFingerprint()

  • Iterates the selected TrackIds and calls
    dao.clearFingerprintData(id) for each.
  • Uses TrackId + DAO directly — no TrackPointer needed, so
    applyTrackPointerOperation is not used.
  • Exposed as "Clear → Fingerprint" in the Clear sub-menu.
  • IWYU direct include of trackfingerprintdao.h added

slotClearAllMetadata() extended

  • After the existing TrackPointerOperation runs, iterates
    getTrackIds() and calls dao.clearFingerprintData() for each.
  • Run after the progress dialog closes; a future PR should fold
    this into the TrackPointerOperation to keep it inside the modal.
  • Unused progressLabelText variable and related TODOs cleaned up
    .

m_pClearFingerprintAction added to the Clear sub-menu between
ClearWaveform and ClearAllMetadata.

Notes for reviewers

  • The "Clear All Fingerprints" button in Prefs and "Clear →
    Fingerprint" in WTrackMenu both call clearFingerprintData()
    directly on the DAO — no Track object is loaded.
  • slotClearAllMetadata's fingerprint loop runs after the progress
    dialog closes and may briefly block the main thread on very large
    selections (DB + file deletions, no audio). Tracked with a TODO.
  • The AcoustID auto-submit checkbox is intentionally disabled when
    the key field is empty to prevent an inconsistent config state.

Depends on: [GSoC] CMRT 02: Analyzer: (#16603)

Adds schema revision 41 to extend the library table with
MusicBrainz and AcoustID metadata fields required for
Chromaprint-based lookup workflows.

New columns:
- musicbrainz_recording_id
- musicbrainz_release_id
- musicbrainz_track_id
- musicbrainz_artist_id
- acoustid_id
- acoustid_lookup_at
- acoustid_lookup_status

Also adds indexes for MusicBrainz and AcoustID lookup paths.

The revision is backwards-compatible and does not modify
existing user data.
Adds schema revision 42 extending track_analysis with a
TEXT payload column intended for small metadata blobs such
as audio quality metrics and Chromaprint version metadata.

Raw fingerprint arrays are intentionally not stored in
the database.

Also adds a composite lookup index on (track_id, type).
Adds schema revision 43 introducing database tables for
Chromaprint fingerprint grouping, CMRT membership,
AcoustID queue management, and AcoustID response caching.

New tables:
- fingerprint_metadata
- cmrt_groups
- cmrt_members
- acoustid_queue
- acoustid_cache

Design notes:
- fingerprint_hash is a non-unique SimHash pre-filter
- chroma_sha256 is used as the canonical integrity key
- raw fingerprint arrays are not stored in SQLite
- ON DELETE CASCADE is intentionally omitted

Also adds supporting indexes and bumps
kRequiredSchemaVersion from 42 to 43.
This commit implements reading, writing, and deleting `.chroma`
binary files directly to disk, avoiding BLOBs in the SQLite database.
It also wires TrackFingerprintDao into the broader DAO ecosystem
and adds file cleanup cascades into the central track purging logic.

Changes:
- trackfingerprintdao.h/cpp: Accept UserSettingsPointer to manage
  paths privately in ~/.mixxx/fingerprints/ and add save/load/delete.
  saveChromaFile uses a write-temp-then-rename pattern.
- trackdao.h/cpp: Add TrackFingerprintDao dependency and loop over
  purged tracks in onPurgingTracks() to call deleteChromaFile().
- trackcollection.cpp: Initialize m_trackFingerprintDao with pConfig
  and pass to m_trackDao.
- libraryscanner.h/cpp: Add TrackFingerprintDao member to satisfy
  the updated TrackDAO constructor dependency during background scans.
Integrate AnalyzerChromaprint into AnalyzerThread and
register analyzerchromaprint sources in CMakeLists.txt.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant